/*!
\copyright  Copyright (c) 2023 Qualcomm Technologies International, Ltd.\n
            All Rights Reserved.\n
            Qualcomm Technologies International, Ltd. Confidential and Proprietary.
\file       ble_link_channel_event_spec.h
\brief      Events sent by the BLE link
*/

#ifndef BLE_LINK_CHANNEL_EVENT_SPEC_H_
#define BLE_LINK_CHANNEL_EVENT_SPEC_H_

#include "channel_event_spec_ids.h"
#include "event_bus_publish.h"

/*! @{ */

/*! \brief The LE Audio BAP profile event channel */
#define EVENT_BUS_CHANNEL_BLE_LINK          ble_link_event_channel

/*! \brief The BLE link events that are sent. */
typedef enum
{
    ble_link_event_connected,
    ble_link_event_disconnected,
    ble_link_event_connecting_failure,
    ble_link_event_conn_param_update_request,
    ble_link_event_conn_param_update_success,
    ble_link_event_conn_param_update_failure,
    ble_link_event_encryption_changed,
    ble_link_event_bond,
} ble_link_event_t;

typedef struct

{
    /*! Connection handle of the device. */
    uint16 connection_handle;
    /*! BT address of connected device. */
    typed_bdaddr taddr;
} ble_link_event_connected_t;

typedef struct
{
    /*! Connection handle of the device. */
    uint16 connection_handle;
    /*! BT address of disconnected device. */
    typed_bdaddr taddr;
    /*! The disconnect status. */
    uint16 status;
} ble_link_event_disconnected_t;

typedef struct
{
    /*! Connection handle of the device. */
    uint16 connection_handle;
    /*! BT address of connecting device. */
    typed_bdaddr taddr;
} ble_link_event_connecting_failure_t;

typedef struct
{
    /*! Connection handle of the device. */
    uint16 connection_handle;
    /*! BT address of requested device. */
    typed_bdaddr taddr;
    /*! The min connection interval. */
    uint16 conn_interval_min;
    /*! The max connection interval. */
    uint16 conn_interval_max;
    /*! The connection latency. */
    uint16 conn_latency;
    /*! The supervision timeout. */
    uint16 supervision_timeout;
} ble_link_event_conn_param_update_request_t;

typedef struct
{
    /*! Connection handle of the device. */
    uint16 connection_handle;
    /*! BT address of device. */
    typed_bdaddr taddr;
    /*! The connection interval. */
    uint16 conn_interval;
    /*! The connection latency. */
    uint16 conn_latency;
    /*! The supervision timeout. */
    uint16 supervision_timeout;
} ble_link_event_conn_param_update_success_t;

typedef struct
{
    /*! Connection handle of the device. */
    uint16 connection_handle;
    /*! BT address of device. */
    typed_bdaddr taddr;
    /*! The connection paramater update status. */
    uint16 status;
} ble_link_event_conn_param_update_failure_t;

typedef struct
{
    /*! Connection handle of the device. */
    uint16 connection_handle;
    /*! BT address of device. */
    typed_bdaddr taddr;
} ble_link_event_encryption_changed_t;

typedef struct
{
    /*! Connection handle of the device. */
    uint16 connection_handle;
    /*! BT address of device. */
    typed_bdaddr taddr;
} ble_link_event_bond_t;

/*! @} */

#endif /* BLE_LINK_CHANNEL_EVENT_SPEC_H_ */

